/*
 * Created on Jun 23, 2004
 */
package org.vectrics.recruiter.job;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.vectrics.domain.Domain;

/**
 * @author mmoore
 */
public class InvokeJobCandidateSkillMatchQuartzJob implements Job {
	private transient final Log log = LogFactory.getLog(this.getClass());
	private Domain domain = null;
	
	/**
	 * 
	 */
	public InvokeJobCandidateSkillMatchQuartzJob(Domain domain) {
		super();
		this.domain = domain;
	}

	public void execute(JobExecutionContext jobContext) throws JobExecutionException {
		log.debug("Starting InvokeJobAgentsQuartzJob");
		try {
			JobCandidateSkillMatchBatch invoker = new JobCandidateSkillMatchBatch(this.domain);
			invoker.run();
		} catch (Exception ex) {
			log.error("Exception invoking job agent", ex);
		}
		
		if (log.isDebugEnabled())
			log.debug("Done with job agent invocation, next fire time: " + jobContext.getNextFireTime());
	}
}
